﻿#region

using Microsoft.AspNetCore.Http;
using Vin.Extension.JwtBearer.Models;
using Vin.Extension.JwtBearer.Tool;
using Vin.Tool.Domain.ExceptionModel;

#endregion

namespace Vin.Extension.Framework.Models;

public record VinTokenModel : VinJwtTokenModel
{
    /// <summary>
    /// 是否是超级管理员
    /// </summary>
    public bool? IsSuperAdmin { get; set; }

    /// <summary>
    /// 是否登录成功
    /// </summary>
    public bool LoginSuccess { get; set; } = false;

    /// <summary>
    /// 权限
    /// </summary>
    public List<string>? Permissions { get; set; }
}

internal class VinTokenModelTool
{
    public static VinTokenModel? GetTokenModel(string? prefix = null)
    {
        var model =
            VinSecurityTool.GetTokenModelByToken(VinFrameworkExtension.VinAuthorizeModelType, prefix) as VinTokenModel;
        return model;
    }
}